package com.controller.after;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.common.ajax.AjaxRes;
import com.controller.base.BaseController;
import com.entity.Student;
import com.service.StudentService;
@Controller
@RequestMapping("/studentcontorller/")
public class StudentController extends BaseController<Object>{
	@Autowired
	private StudentService stuService;

	@RequestMapping("/StudentShow")
	public ModelAndView find(){
		ModelAndView mv=new ModelAndView();
		Student stu=new Student();
		List<Student> stuList=stuService.find(stu);
		mv.addObject("Student", stuList.get(0));
		mv.setViewName("pulicpage/Student");
		return mv;
	}
	
	@RequestMapping("/add")
	@ResponseBody
	public AjaxRes add(Student student)throws Exception{
//		ModelAndView mv =  new ModelAndView();
		AjaxRes ajax=new AjaxRes();
//		stuService.find(student);
		ajax.setResMsg("成功");
		return ajax;
	}
}
